<template>
  <svg class="svg-icon" aria-hidden="true" @click="clickIcon">
    <use :xlink:href="iconName" />
  </svg>
</template>

<script>

export default {
  name: "SvgIcon",
  props: {
    iconClass: {
      type: String,
      required: true
    }
  },
  computed: {
    iconName() {
      return `#icon-${this.iconClass}`;
    },
    svgClass() {
      if (this.className) {
        return `svg-icon ${this.className}`;
      }
      return "svg-icon";
    }
  },
  methods: {
    clickIcon() {
      this.$emit("clickIcon");
    }
  }
};
</script>
<style scoped>
.svg-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  overflow: hidden;
  fill: currentcolor;
}
</style>